﻿using Terraria;
using Terraria.ModLoader;

namespace FirstMod.Commands
{
	public class ItemCommand : ModCommand
	{
		public override CommandType Type
		{
			get { return CommandType.Chat; }
		}

		public override string Command
		{
			get { return "myitem"; }
		}

		public override string Usage
		{
			get { return "/myitem"; }
		}

		public override string Description 
		{
			get { return "Spawn"; }
		}

        public override void Action(CommandCaller caller, string input, string[] args)
        {
            string name = "";
            if (args.Length >= 1)
            {
                if (args[0] == "1")
                {
                    name = "GoodWings";
                }
                else if(args[0] == "2")
                {
                    name = "GoodLeggings";
                }
                int stack = 1;
                if (args.Length >= 2)
                    stack = int.Parse(args[0]);

                caller.Player.QuickSpawnItem(mod.ItemType(name), stack);
                throw new UsageException("Give you " + stack + " one");
            }
            else
            {
                throw new UsageException("sss");
            }
        }
    }
	}
